<?php

$headers = [];
foreach ($_SERVER as $name => $value) {
    if (substr($name, 0, 5) == 'HTTP_') {
        $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
    }
}
// 密码验证
if ($headers["X-Gitee-Token"] !== 'htbsc') {
    echo '非法操作';
    die;
}

chdir("/www/wwwroot/htbsc/htbsc-php");
exec("git pull origin master 2>&1", $out);
foreach ($out as $v) {
    echo iconv('GB2312', 'UTF-8', $v) . "<br>";
}

?>
